<?php
class PageWidget extends Widget {

	public function render($data) {
		global $cmstag;
		$parseStr = '';
		$type = empty($data['show'])?array('show'=>'total,FirstPage,PreviousPage,PageNavigation,nextpage,Lastpage,JumpPage'):$data['show'];
		if(!empty($data['type'])) {
			if($data['type'] == 'channels') {
				$count = empty($cmstag['page']['channels']['count'])?0:$cmstag['page'][$data['type']]['count'];
				$pagesize = empty($cmstag['page']['channels']['pagesize'])?0:$cmstag['page'][$data['type']]['pagesize'];
				$nowPage = empty($cmstag['page'][$data['type']][$cmstag['contentlist']['id']]['current'])?1:intval($cmstag['page'][$data['type']][$cmstag['contentlist']['id']]['current']);
				$catenaming = common('Array')->getParseTemplate($cmstag['contentlist'],$cmstag['contentlist']['catenaming'],'cateid');
				if(!empty($catenaming)) {
					$arr = explode('.',$catenaming);
					$url = $arr[0];
					$prex = $arr[1];
				}
			}
		}
		$list = explode(',',$type);
		foreach ($list as $k => $v) {
			$parseStr .= getPage($count,$pagesize,$v,$nowPage,"$url","$prex",$vv);
		}
		return $parseStr;
	}
}